#include<iostream>
#include<cstdio>
using namespace std;
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	int n,p=0;
	cin>>n; p=n;
	int a[200001];
	for(int i=1;i<=n;i++){
	scanf("%d",&a[i]);
	}
	int k=a[1];
	a[1]=-1;
	cout<<1<<" ";
	int j=1; 
	p--;
	while(p!=0){
		for(int i=j+1;i<=n;i++){
			if(a[i]!=-1&&a[i]!=k){
				p--;
				printf("%d ",i);
				k=a[i];
				a[i]=-1;
			}
		}
		j=1;
		while(a[j]!=-1)
		j++;
		k=a[j];
		cout<<endl;
	}
	return 0;
}
